package chai.ningning.schedule;

public class PriorityTest {

    static class PriorityThread extends Thread{
        public PriorityThread(String name) {
            super(name);
        }

        @Override
        public void run() {
            Thread t = Thread.currentThread();
            for (int i = 0; i < 5; i++) {
                System.out.println(t + "::" + t.getPriority());
            }
        }
    }

    public static void main(String[] args) {
        Thread first = new PriorityThread("FIRST");
        first.setPriority(Thread.MAX_PRIORITY);
        Thread second = new PriorityThread("SECOND");
        second.setPriority(Thread.MIN_PRIORITY);
        Thread third = new PriorityThread("THIRD");
        third.setPriority(Thread.NORM_PRIORITY);

        first.start();
        second.start();
        third.start();
    }
}
